"""
最高字符词频统计
不包括标点符号
"""
if __name__ == '__main__':
    fi = open('小女孩.txt','r',encoding='utf-8')
    fo = open('PY301-1.txt','w')
    d={}
    txt = fi.read()
    exclude = "，。！？、（）【】<>《》=:+-*—“”…"
    for word in txt:
        if word in exclude:
            continue
        else:
            d[word]  = d.get(word,0)+1
    ls = list(d.items())
    ls.sort(key=lambda x:x[1],reverse=True)
    #输出频次最高的中文字符及频次
    fo.write("{}:{}".format(ls[0][0],ls[0][1]))
    fo.close()

